
import socket

print socket.gethostbyaddr(socket.getfqdn(socket.gethostname()))

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("www.nus.edu.sg", 80))
print s.getsockname()

